Topics Covered:
Click the button below to test the code for sorting, searching and data structures.
(a) Pascal’s triangle is a number triangle with numbers arranged in staggered rows such that
anr = n!/ r!(n - r)!
This equation is the equation for a binomial coefficient. You can build
Pascal’s triangle by adding the two numbers that are diagonally above a number in the triangle. Write a program
that prints out Pascal’s triangle in O(n2). Provide an example for testing purposes.
Example:
Enter the degree:
Print Pascal's TriangleSum of numbers n + (n - 2) + (n - 4) + ... (until n <= 0)
Enter n:
print sum